precision mediump float;
//GLint positionAttribute,a_normal,a_binorm,a_tgt,uv_posAttribute;//in vertex
varying vec3 v_tangentW;
varying vec3 v_bitangentW;
varying vec3 v_normalW;
varying vec2 v_uv;

//uniform vec3 LightDirection;
uniform sampler2D u_texture;
uniform sampler2D u_texture0;
void main()
{
 vec3 LightDirection = vec3(0.5,0.5,0.5);
    vec3 normal = texture2D(u_texture0,v_uv).xyz;
    mat3 TBN = mat3(normalize(v_tangentW),normalize(v_bitangentW),normalize(v_normalW));
    vec3 normalW = normalize((TBN * (2.0 * normal - 1.0)).xyz);
    float diffuse = max(0.0, dot(-LightDirection,normalW));
    vec4 color = texture2D(u_texture,v_uv);
    gl_FragColor =  vec4(diffuse * color.xyz,color.a);
}